// TOWN DIALOGUE SCRIPT
//    Town 143: Storm Port

begintalkscript;

variables;

short i,j,k,r1,choice;

// Mayor Runkle

begintalknode;
	tag = 40;
	state = -1;
	nextstate = 1;
	question = "Mayor Runkle";
	text1 = "You meet a tired, thin old man. He sits behind the desk, contemplating a skull. You notice that the skull has rubies for eyes. _Greetings. I'm Mayor Runkle._";
	text5 = "Mayor Runkle sits and contemplates his skull. _Yes? What else?_";
	action = INTRO;

begintalknode;
	state = 1;
	nextstate = -1;
	question = "_Why are you looking at a skull?_";
	text1 = "_It belonged to a nasty undead creature. When my soldiers destroyed it, it was brought to me. The undead to the northeast aren't as bad as the monster plagues I hear the big cities have been having, but they are a threat._";
	text3 = "_It belonged to one of the undead who were attacking us, when the undead were still attacking._";
	action = DEP_ON_SDF 52 9 0;

begintalknode;
	state = 1;
	nextstate = 2;
	question = "_Tell me about your town._";
	text1 = "_I'm the mayor of Storm Port. It's sort of a different post around here. I'm the administrator for several towns. And believe me, we have problems._";

begintalknode;
	state = 2;
	nextstate = -1;
	question = "_Which towns are you the administrator of?_";
	text1 = "He counts the towns off on his fingers. _Storm Port. Libras. Lost Isle. Gorst. Gebra. Bolton. Squiggus. I take care of administrative details for them all. And, of course, try to protect them from monsters._";

begintalknode;
	state = 2;
	nextstate = 3;
	question = "_What problems have you had to deal with? Are there monsters here as well?_";
	text1 = "He holds up the skull he was looking at. _There's undead to the northeast, lots of them. We don't know who's making them, and they move farther south every day. The Empire's no use, as always._";
	text3 = "_Oh, there's no shortage. The undead problem to the north has subsided for some reason, but there's basilisks to the south, and ursagi to the north, and the Empire's no use, as always._";
	action = DEP_ON_SDF 52 9 0;

begintalknode;
	state = 3;
	nextstate = -1;
	question = "_Why doesn't the Empire send you help?_";
	text1 = "_When things were peaceful, an Empire adjunct would be through every week, bothering me about one thing or another. Now, when we really need their help, we don't get one gold piece, not one soldier._";
	text2 = "_I don't know what's going on up there, but if they don't start helping out more, this whole area will go straight to hell._";

begintalknode;
	state = 3;
	nextstate = -1;
	question = "_Shouldn't you send someone out to take care of these monsters?_";
	text1 = "He covers his face with his hands. _Of course, but I have almost no troops, and no money to pay some useless mercenaries. And the Empire doesn't help at all. I'd quit this job in an instant, but nobody is dumb enough to replace me!_";

begintalknode;
	state = 3;
	nextstate = -1;
	condition = gf(143,11) <= 1;
	question = "_What sort of undead are attacking?_";
	text1 = "_Oh, the standard array. Ghasts and ghouls to stalk our soldiers. Shades to float in and kill our livestock. And zombies to chase the kids around._";

begintalknode;
	state = 3;
	nextstate = -1;
	condition = gf(143,11) <= 1;
	question = "_I am an adventurer. I'm sure I can deal with this undead problem._";
	text1 = "_And I suppose you'll be wanting a reward when you're done. Well, we don't have any money to give you. And we need all of our supplies. So do what you want, but don't expect much._";
	text2 = "_Rumor has it a tower appeared to the north. Just appeared. Poof. There are lots of ghouls and such around there now. Seems a natural place to investigate._";
	code =
		toggle_quest(55,1);
		sf(143,11,1);
	break;

begintalknode;
	state = 1;
	nextstate = -1;
	condition = gf(143,11) == 1 && gf(52,9) >= 1;
	question = "_I slew a vampire named Vahkohs. You should have little trouble with the undead now._";
	code =
		run_hardcode(31);
	break;

// Dana

begintalknode;
	tag = 60;
	state = -1;
	nextstate = 29;
	question = "Dana";
	text1 = "This woman is a middle-aged merchant, dignified and calm. She is wearing fine jewelry and rich clothes.";
	text2 = "She greets you and shows you her luxurious wares, enabling you to tell how nervous she is under the surface. As she shows you an assortment of fine cloaks, she says, _I am Dana, by the way._";
	text5 = "Dana still looks on edge. _What? Yes? What now, adventurer?_";
	action = INTRO;

begintalknode;
	state = 29;
	nextstate = 30;
	question = "_What trade are you in?_";
	text1 = "_Well, I run shipping up and down the east coast. Right now, we're looking for couriers._";

begintalknode;
	state = 30;
	nextstate = -1;
	question = "_Up the east coast to where?_";
	text1 = "_From here up to Squiggus, and beyond._";

begintalknode;
	state = 30;
	nextstate = 31;
	question = "_How does one become a courier?_";
	text1 = "_We need supplies run up to Squiggus. You can purchase bundles here, and carry them up there. They'll pay you handsomely for them._";
	text2 = "_It's been very hard to get couriers lately, alas. There's been some monster troubles._";
	code =
		sf(143,8,1);
	break;
	
begintalknode;
	state = 31;
	nextstate = -1;
	question = "_Do you know anything about the monster troubles?_";
	text1 = "She looks annoyed, but not at you. _You should ask Mayor Runkle. He's next door. He's been useless for dealing with the problem, but at least he may be able to explain it._";

begintalknode;
	state = 29;
	nextstate = -1;
	condition = gf(143,8) > 0;
	question = "_I'd like to buy some bundles to take up to Squiggus._";
	text1 = "You conclude your business.";
	code =
		begin_shop_mode("Clothes for Squiggus","The clothes are thick and bulky, good quality winter wear. The bundles of garments are heavy and awkward, so you'll have difficulty carrying much of the stuff around.",69,2,3);
	break;

begintalknode;
	state = 29;
	nextstate = 32;
	condition = gf(143,11) >= 2;
	question = "_Mayor Runkle said that you could reward me for helping with the undead._";
	text1 = "_Allegedly helping with the undead, you mean. I knew he would stick me with this problem. I told him he shouldn't ask you anything._ She sighs. _All right. You're an adventurer. I have something that can help you._";
	text2 = "_Go into my home and look under the bed. There's a book there. You can read it. You might learn from it._";
	action = SET_SDF 143 12 1;

begintalknode;
	state = 32;
	nextstate = -1;
	question = "_Where is your home?_";
	text1 = "_The northwest corner of town._";

// Valentino

begintalknode;
	tag = 80;
	state = -1;
	nextstate = 57;
	question = "Valentino";
	text1 = "A tall, thin, twitchy man is sitting behind the counter. He's using a rag to energetically polish what looks, to you, like a shard of broken glass. He stands up. _Ah! Welcome to you, stout traveler! I am Valentino! Welcome to my shop!_ He sits back down.";
	text5 = "_Well, now. Want to buy something?_ Valentino is still polishing a shard of broken glass.";
	action = INTRO;

begintalknode;
	state = 57;
	nextstate = 58;
	question = "_What sort of shop is this?_";
	text1 = "He's very pleased that you asked. _Why, I collect and distribute all manner of wondrous items! Here is how the process works! You sell me the excess crud you don't want. I hike the price, and make it available to others for purchase. Elegant, eh?_";

begintalknode;
	state = 58;
	nextstate = -1;
	question = "_What sort of wondrous items do you have?_";
	text1 = "_Well all sorts of wondrous items. And, of course, a lot of garbage._ He shrugs.";

begintalknode;
	state = 57;
	nextstate = -1;
	question = "_Let's do some trading._";
	text1 = "You conclude your business.";
	code =
		begin_shop_mode("Valentino's Items","Valentino seems blissfully lacking in any idea of what items are valuable and what aren't. However, with time, you are able to pick through the debris and find a few nice things.",70,3,3);
	break;

begintalknode;
	state = 58;
	nextstate = -1;
	question = "_Elegant seems like a strange word to use._";
	text1 = "_Perhaps. And yet, it is so._";
	
begintalknode;
	state = 57;
	nextstate = -1;
	condition = 1;
	question = "_I would like to sell something._";
	text1 = "You conclude your business.";	
	code = 
		begin_sell_mode();
	break;

begintalknode;
	state = 57;
	nextstate = -1;
	condition = 1;
	question = "_I don't need anything._";
	text1 = "_I hope you return soon to be spending money, traveler!_";
	action = END_TALK;

// Laika

begintalknode;
	tag = 100;
	state = -1;
	nextstate = 85;
	question = "Laika";
	text1 = "A beggarwoman kneels by the docks. In addition to an alms bowl, she holds a roll of tickets. _I am Laika._";
	text5 = "Laika watches you, alms bowl in one hand, tickets in the other.";
	action = INTRO;

begintalknode;
	state = 85;
	nextstate = -1;
	question = "_Are you selling those tickets?_";
	text1 = "She sneezes and wipes her nose on her sleeve. _Well, I'm a beggar, really. But lately I've been more of a ticket seller._";

begintalknode;
	state = 85;
	nextstate = 86;
	question = "_What are the tickets for?_";
	text1 = "_You can purchase tickets to the city of Gebra from me. Only twelve coins: ten for the ticket plus a two coin service charge._";

begintalknode;
	state = 86;
	nextstate = -1;
	question = "_What's the service charge for?_";
	text1 = "_It's also known as a 'Keep the poor beggarwoman from starving to death charge.'_ Seems reasonable enough, when put like that.";

begintalknode;
	state = 85;
	nextstate = 87;
	condition = coins_amount() >= 12;
	question = "_I want to buy some tickets._ Pay twelve coins.";
	text1 = "She takes your money and hands you your tickets. Three of your coins end up in her bowl. She then says, _Donate a few coins to the cause, kind adventurer?_";
	text5 = "You have already bought a ticket.";
	code =
		cs();
		if (gf(143,9) > 0)
			as(5);
			else {
				sf(143,9,1);
				change_coins(-12);
				as(1);
				}
	break;

begintalknode;
	state = 87;
	nextstate = 85;
	condition = coins_amount() >= 5;
	question = "Give five coins. _OK. Here you go._";
	text1 = "You hand her more money. She says, _Watch yourselves on Gebra, unless you're well-equipped to defend yourselves. They're a weird lot, and not everyone who goes there comes back, if you get my meanin'._";
	code =
		change_coins(-5);
	break;	

begintalknode;
	state = 87;
	nextstate = -1;
	question = "_No. I don't give to beggars._";
	text1 = "_Fine. Bye._";
	action = END_TALK;

begintalknode;
	state = 85;
	nextstate = -1;
	condition = 1;
	question = "_Good day to you._";
	text1 = "_Bye!_";
	action = END_TALK;

